/**
 * jQuery Plugin
 * requires jQuery 1.4 or later
 *
 * Released under the MIT license
 * http://jquery.org/license
 *
 * User: wuqinglong
 * mail: hellowql@126.com
 * Date: 13-8-29
 * Time: 上午10:37
 * Version: 0.1
 */

module.exports={
    run:function(cb){
        console.log('run db.bat to start mongodb--------');
        var exec = require('child_process').exec;


        exec('d:/mongodb/bin/mongod.exe -dbpath D:/mongodb/blog --repair --repairpath D:/mongodb/blog',function (error, stdout, stderr) {
            console.log('--repairpath mongodb');
            console.log('error:'+error);
            console.log('stderr:'+stderr);

        });
        exec('d:/mongodb/bin/mongod.exe -dbpath D:/mongodb/blog',function (error, stdout, stderr) {
            console.log('--change dbpath')
            if (error !== null) {
                console.log('exec error: ' + error);
            }else{
                console.log('mongodb started');
                if(cb){
                    cb();
                }
            }
        });

    }
}